/**
 * 
 */
package cn.ac.istic.lkt.atv;

import java.awt.font.FontRenderContext;

/**
 * @author Chongde Shi
 *
 */
public class PTNode {
	public static final int NT=0; //non-terminal
	public static final int POS=1; // part of speech
	public static final int WD=2; // word
	public static final int UP=0;
	public static final int DOWN=1;
	
	private int id 		= -1; 
	private String label;
	private int depth 	= -1; 
	private int height = -1;
	private int parent 	= -1;
	private int child 	= -1;
	private int brother = -1;
	private int type	= 0; //
	private int pos = -1; //在句子中的位置（必须为叶节点才有）
	private FontRenderContext frc = null;
	private int direction = UP;
	
	private float x=0;			//词的x坐标
	private float xmiddle=0;	//连线的x坐标
	private float y=0;			//词的y坐标
	private float yup=0;	//上连线坐标
	private float ydown=0;		//下连线坐标
	
	public PTNode(int id, String s, int d, int t){
		this.id = id;
		this.label = s;
		this.depth = d;
		this.type = t;
	}

	//get envirenment to paint
	public void initEnv(FontRenderContext f, int d){
		this.frc = f;
		this.direction = d;
	}
	
	public boolean isWord(){
		return type==WD;
	}
	
	public boolean isPOS(){
		return type==POS;
	}
	public boolean isNT(){
		return type==NT;
	}
	public int getID(){
		return this.id;
	}

	public void setID(int id){
		this.id = id;
	}

	public String getLabel(){
		return this.label;
	}

	public void setLabel(String s){
		this.label = s;
	}
	
	public int getDepth(){
		return this.depth;
	}
	
	public void setDepth(int i){
		this.depth = i;
	}
	
	public int getHeight(){
		return this.height;
	}
	
	public void setHeight(int i){
		this.height = i;
	}
	
	public int getParent(){
		return this.parent;
	}
	
	public void setParent(int i){
		this.parent = i;
	}
	
	public int getChild(){
		return this.child;
	}
	
	public void setChild(int i){
		this.child = i;
	}
	
	public int getBrother(){
		return this.brother;
	}
	
	public void setBrother(int i){
		this.brother = i;
	}
	
	public int getType(){
		return this.type;
	}
	
	public void setType(int i){
		this.type = i;
	}
	
	public int getPos(){
		return this.pos;
	}
	
	public void setPos(int i){
		this.pos = i;
	}
	
	public FontRenderContext getFrc() {
		return frc;
	}

	public void setFrc(FontRenderContext frc) {
		this.frc = frc;
	}

	public int getDirection() {
		return direction;
	}

	public void setDirection(int direction) {
		this.direction = direction;
	}

	public float getX() {
		return x;
	}

	public void setX(float x) {
		this.x = x;
	}

	public float getXmiddle() {
		return xmiddle;
	}

	public void setXmiddle(float xmiddle) {
		this.xmiddle = xmiddle;
	}

	public float getY() {
		return y;
	}

	public void setY(float y) {
		this.y = y;
	}


	public float getYup() {
		return yup;
	}

	public void setYup(float yup) {
		this.yup = yup;
	}

	public float getYdown() {
		return ydown;
	}

	public void setYdown(float ydown) {
		this.ydown = ydown;
	}

	public String str(int i){
		if (i>=0) return ""+i;
		else return "  ";
	}
	public String toString(){
		return str(id) + "\t"+ label + "\t" +str(parent) + 
		"\t" + str(child) +"\t" +str(brother)+ "\t" + str(depth) + 
		"\t"+ str(height)+"\t"+ str(type) + "\t" + str(pos);
	}
}
